<h1>Sessions#new</h1>
<h1>用户登录</h1>

<%# 显示 flash.now[:alert] 中的错误信息 %>
<% if flash.now[:alert] %>
  <div class="alert alert-danger" role="alert">
    <%= flash.now[:alert] %>
  </div>
<% end %>

<%= form_with(url: login_path, scope: :session, local: true) do |form| %>
  <div class="form-group">
    <%= form.label :email, "电子邮箱" %>
    <%= form.email_field :email, class: "form-control" %>
  </div>

  <div class="form-group">
    <%= form.label :password, "密码" %>
    <%= form.password_field :password, class: "form-control" %>
  </div>

  <div class="form-group form-check">
    <%= form.check_box :remember_me, class: "form-check-input" %>
    <%= form.label :remember_me, "记住我", class: "form-check-label" %>
  </div>

  <%= form.submit "登录", class: "btn btn-primary" %>
<% end %>

<p>还没有账号？<%= link_to "立即注册", signup_path %></p>
